﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;
using WoChu.RfClient.Duty.IFace;

namespace WoChu.RfClient.Duty
{
    public class ProfitAndLossUIRule
    {
        private static ProfitAndLossUIRule _NewInstance = new ProfitAndLossUIRule();

        public static ProfitAndLossUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new ProfitAndLossUIRule();
                }

                return _NewInstance;
            }
        }

        public bool InsertProfitAndLoss(string orderNo, string oprNo, List<ProfitAndLossDetailInfo> profitAndLossInfo)
        {
            bool _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IProfitAndLoss>.NewInstance.InvokeWebMethod<List<ProfitAndLossDetailInfo>, bool>("InsertProfitAndLoss", new object[] { orderNo, oprNo }, profitAndLossInfo);

            return _result;
        }

        public List<LookUpItemInfo> Query(string lookId)
        {
            try
            {
                List<LookUpItemInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IProfitAndLoss>.NewInstance.InvokeWebMethod<List<LookUpItemInfo>>("Query", new object[] { lookId });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public string GetGoodsNameByCode(string goodCode)
        {
            try
            {
                string _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IProfitAndLoss>.NewInstance.InvokeWebMethod<string>("GetGoodsNameByCode", new object[] { goodCode });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }


    }
}
